package com.meida.module.bus.client.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * 支付类型
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum PayTypeEnum {
    PAY_WX("PAY_WX", "讯联微信"),
    PAY_WX_YINLIAN("PAY_WX_YINLIAN", "讯联微信"),
    PAY_BALANCE("PAY_BALANCE", "余额支付"),
    PAY_COMPANY_BALANCE("PAY_COMPANY_BALANCE", "公司余额支付"),
    PAY_UNDERLINE("PAY_UNDERLINE", "线下支付");

    PayTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @EnumValue
    private final String code;
    private final String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static PayTypeEnum getByValue(String code) {
        for (PayTypeEnum payTypeEnum : values()) {
            if (code.equals(payTypeEnum.getCode())) {
                return payTypeEnum;
            }
        }
        return null;
    }
}
